package cn.shb.controller;

import cn.shb.bean.Admin;
import cn.shb.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("admin")
@CrossOrigin(maxAge = 3600)//允许跨域
public class AdminController {

    //依赖注入
    @Autowired
    AdminService adminService;

    @RequestMapping("list")
    public List<Admin>getAdminList(){
        List<Admin>list=adminService.list();
        return list;
    }
}
